$(function(){

	asideClickHandle();

	$(".userManage").on("click",function(){
		$(".contanier-fluid").load("./userManage.html .contanier-fluid > *")
	})

	column();
	pie();

});

var column = function(){
	var data = [
		{
			name:"一月",
			value: 20
		},
		{
			name:"二月",
			value: 120
		},
		{
			name:"三月",
			value: 220
		},
		{
			name:"四月",
			value: 320
		},
		{
			name:"五月",
			value: 420
		},
		{
			name:"六月",
			value: 520
		},
		{
			name:"七月",
			value: 620
		}
	]
	var xData =[],yData =[];
	data.forEach(function(item,i){
		xData.push(item.name);
		yData.push(item.value);
	})

	var myChart = echarts.init(document.querySelector(".picBar"));
	var option = {
		 	title : {
		        text: '2019年注册人数',
		        x:'left'
		    },
		    tooltip : {
		    },
		    legend: {
		        data:['人数']
		    },
		   
		    xAxis : [
		        {
		            type : 'category',
		            data : xData,
		        }
		    ],
		    yAxis : [
		        {
		            type : 'value'
		        }
		    ],
		    series : [
		        {
		            name:'人数',
		            type:'bar',
		            barWidth: '60%',
		            data:yData
		        }

		    ]
		}

	myChart.setOption(option);
}

var pie = function(){

	var data = [
		{
			name:"耐克",
			value: 335
		},
		{
			name:"阿迪",
			value: 310
		},
		{
			name:"百伦",
			value: 234
		},
		{
			name:"安踏",
			value: 135
		},
		{
			name:"李宁",
			value: 1548
		}
	]
	var xData =[],yData =[];
	data.forEach(function(item,i){
		xData.push(item.name);
		yData.push(item.value);
	})

	var myChart = echarts.init(document.querySelector(".picPie"));
	var option = {
		    title : {
	        text: '热门品牌销售',
	        subtext: '2017年6月',
	        x:'center'
		    },
		    tooltip : {
		        trigger: 'item',
		        formatter: "{b} : {c} ({d}%)"
		    },
		    legend: {
		        orient: 'vertical',
		        left: 'left',
		        data: xData
		    },
		    series : [
		        {
		            type: 'pie',
		            radius : '55%',
		            center: ['50%', '60%'],
		            data: data,
		            itemStyle: {
		                emphasis: {
		                    shadowBlur: 10,
		                    shadowOffsetX: 0,
		                    shadowColor: 'rgba(0, 0, 0, 0.5)'
		                }
		            }
		        }
		    ]
		}

	myChart.setOption(option);	
}